<?php
require_once(dirname(__FILE__).'/../lib/ajax.php');
Event::addListener('shutdown', array('Ajax', 'echoJson'));

$f = $_REQUEST['f'];

if (empty($f)) {
	Event::log('rpc', 'No function given', Event::LOG_ERROR);
}

$module = substr($f, 0, strpos($f, '_'));
Core::inc('modules/'.$module.'/rpc.php');

if (!function_exists('rpc_'.$f)) {
	Event::log('rpc', 'Function not found', Event::LOG_ERROR);
}
call_user_func('rpc_'.$f);

?>